home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Multimedia Viewer How-To CD / Microsoft Multimedia Viewer How-To CD.iso / viewerht / addons / mvvbx / mvspy.frm < prev    next >
Text File  |  1993-08-16  |  8KB  |  276 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Viewer Message Spy"
  6.    ClientHeight    =   3300
  7.    ClientLeft      =   945
  8.    ClientTop       =   1650
  9.    ClientWidth     =   7290
  10.    FillColor       =   &H00C0C0C0&
  11.    Height          =   3930
  12.    Left            =   915
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   3300
  15.    ScaleWidth      =   7290
  16.    Top             =   1050
  17.    Width           =   7350
  18.    Begin Frame Frame3 
  19.       BackColor       =   &H00C0C0C0&
  20.       Caption         =   "Command Line"
  21.       Height          =   675
  22.       Left            =   105
  23.       TabIndex        =   4
  24.       Top             =   2505
  25.       Width           =   6990
  26.       Begin CommandButton Command1 
  27.          Caption         =   "Run"
  28.          Height          =   285
  29.          Left            =   5835
  30.          TabIndex        =   6
  31.          Top             =   270
  32.          Width           =   1005
  33.       End
  34.       Begin TextBox VCommand 
  35.          BackColor       =   &H00FFFFFF&
  36.          FontBold        =   0   'False
  37.          FontItalic      =   0   'False
  38.          FontName        =   "MS Sans Serif"
  39.          FontSize        =   8.25
  40.          FontStrikethru  =   0   'False
  41.          FontUnderline   =   0   'False
  42.          Height          =   285
  43.          Left            =   165
  44.          TabIndex        =   5
  45.          Top             =   270
  46.          Width           =   5685
  47.       End
  48.    End
  49.    Begin Frame Frame2 
  50.       BackColor       =   &H00C0C0C0&
  51.       Caption         =   "Messages"
  52.       Height          =   2400
  53.       Left            =   2250
  54.       TabIndex        =   2
  55.       Top             =   60
  56.       Width           =   4845
  57.       Begin ListBox Messages 
  58.          BackColor       =   &H00C0C0C0&
  59.          Height          =   1980
  60.          Left            =   90
  61.          TabIndex        =   3
  62.          Top             =   300
  63.          Width           =   4650
  64.       End
  65.    End
  66.    Begin Frame Frame1 
  67.       BackColor       =   &H00C0C0C0&
  68.       Caption         =   "Open Titles"
  69.       Height          =   2385
  70.       Left            =   105
  71.       TabIndex        =   0
  72.       Top             =   60
  73.       Width           =   2040
  74.       Begin ListBox Titles 
  75.          BackColor       =   &H00C0C0C0&
  76.          Height          =   1980
  77.          Left            =   165
  78.          TabIndex        =   1
  79.          Top             =   300
  80.          Width           =   1740
  81.       End
  82.    End
  83.    Begin MVIEW MV1 
  84.       BaggageFile     =   ""
  85.       Left            =   525
  86.       optCmd          =   0  'cmdoptNONE
  87.       Top             =   3210
  88.       VGetInfo        =   0   'False
  89.       VGetInfohWnd    =   0
  90.       ViewerCommand   =   ""
  91.       ViewerTitle     =   ""
  92.       VInfo           =   "╘ê∩ "
  93.       VInfoMsg        =   0  'GI_NOTHING
  94.       Vwr             =   0
  95.    End
  96.    Begin CommonDialog CMDialog 
  97.       Left            =   30
  98.       Top             =   3195
  99.    End
  100.    Begin Menu File_menu 
  101.       Caption         =   "&File"
  102.       Begin Menu File_Open 
  103.          Caption         =   "Open..."
  104.       End
  105.    End
  106. End
  107. Sub AddMessage (ByVal myMessage$)
  108. Messages.AddItem myMessage$
  109. Messages.ListIndex = Messages.NewIndex
  110. If Messages.ListCount > 50 Then
  111.     Messages.RemoveItem Messages.ListCount - 1
  112. End If
  113. End Sub
  114.  
  115. Sub File_Open_Click ()
  116. CMDialog.DefaultExt = "MVB"
  117. CMDialog.DialogTitle = "Choose a Viewer File"
  118. CMDialog.Filter = "Viewer File|*.MVB|All|*.*"
  119. CMDialog.Action = 1
  120. MV1.ViewerTitle = CMDialog.Filename
  121. MV1.optCmd = 0
  122. MV1.Vwr = 0
  123. MV1.ViewerCommand = "Prev()"
  124. MV1.ViewerExecute = True
  125. If MV1.Vwr > 0 Then
  126.     '
  127.     Titles.AddItem CMDialog.Filetitle
  128.     Titles.ItemData(Titles.NewIndex) = MV1.Vwr
  129.     MV1.ViewerCommand = "RegisterRoutine(`VBMVLINK',`BroadcastMessages',`U')"
  130.     MV1.ViewerExecute = True
  131.     MV1.ViewerCommand = "BroadcastMessages (hwndApp)"
  132.     MV1.ViewerExecute = True
  133. Else
  134.     MsgBox "This file could not be opened", 16, "Error!"
  135. End If
  136.  
  137. End Sub
  138.  
  139. Function ItemFromVwr (ByVal myvwr)
  140. y = Titles.ListCount - 1
  141. For x = 0 To y
  142.     If Titles.ItemData(x) = myvwr Then
  143.         ItemFromVwr = x
  144.         GoTo allDone2
  145.     End If
  146. Next x
  147. ItemFromVwr = -1
  148. allDone2:
  149. End Function
  150.  
  151. Sub MV1_Activate (Vwr As Integer, Gotfocus As Long)
  152.     M$ = NameFromVwr$(Vwr) + ":Activate"
  153.     If Gotfocus = 0 Then
  154.     Q$ = " Losing Focus"
  155.     Else
  156.     Q$ = " Gaining Focus"
  157.     End If
  158.     AddMessage M$ + Q$
  159.  
  160. End Sub
  161.  
  162. Sub MV1_ActivateWin (Vwr As Integer, WinState As Long, WhichWindow As Long)
  163.     M$ = NameFromVwr$(Vwr) + ":ActivateWin"
  164.     AddMessage M$
  165.     If WinState = 0 Then
  166.     Q1$ = " Deactivating "
  167.     Else
  168.     Q1$ = " Activating "
  169.     End If
  170.     If WinState = 0 Then
  171.     Q2$ = " Main Window"
  172.     Else
  173.     Q2$ = " Secondary Window"
  174.     End If
  175.     AddMessage M$ + Q1$ + Q2$
  176.  
  177. End Sub
  178.  
  179. Sub MV1_ChgFile (Vwr As Integer, MVBFileName$, SecondaryWindow As Long)
  180.     M$ = NameFromVwr$(Vwr) + ":ChgFile"
  181.     If SecondaryWindow = 0 Then
  182.     Q1$ = " Main Window from "
  183.     Else
  184.     Q1$ = " Secondary Window from "
  185.     End If
  186.     
  187.     AddMessage M$ + Q1$ + MVBFileName$
  188.  
  189. End Sub
  190.  
  191. Sub MV1_EndConfig (Vwr As Integer, SecondaryWindow As Long)
  192.     M$ = NameFromVwr$(Vwr) + ":EndConfig"
  193.     If SecondaryWindow = 0 Then
  194.     Q1$ = " Main Window from "
  195.     Else
  196.     Q1$ = " Secondary Window from "
  197.     End If
  198.     
  199.     AddMessage M$ + Q1$
  200.  
  201. End Sub
  202.  
  203. Sub MV1_EndJump (Vwr As Integer, TopicAddress As Long, ScrollPosition As Long)
  204.     M$ = NameFromVwr$(Vwr) + ":EndJump "
  205.     AddMessage M$ + "Topic # " + Format$(TopicAddress) + " Scroll " + Format$(ScrollPosition)
  206.  
  207. End Sub
  208.  
  209. Sub MV1_Init (Vwr As Integer, hViewerInst As Long)
  210.     M$ = NameFromVwr$(Vwr) + ":Init"
  211.     AddMessage M$ + " hInst=" + Format$(hViewerInst)
  212. End Sub
  213.  
  214. Sub MV1_MinMax (Vwr As Integer, MinMaxState As Long)
  215.     M$ = NameFromVwr$(Vwr) + ":MinMax"
  216.     If MinMaxState = 1 Then
  217.     Q1$ = " Minimized"
  218.     Else
  219.     Q1$ = " Maximized"
  220.     End If
  221.     
  222.     AddMessage M$ + Q1$
  223. End Sub
  224.  
  225. Sub MV1_Scroll (Vwr As Integer, TopicAddress As Long, ScrollPosition As Long)
  226.     M$ = NameFromVwr$(Vwr) + ":Scroll"
  227.     AddMessage M$ + "Topic # " + Format$(TopicAddress) + " Scroll " + Format$(ScrollPosition)
  228.  
  229. End Sub
  230.  
  231. Sub MV1_Size (Vwr As Integer, iWidth As Long, iHeight As Long)
  232.     M$ = NameFromVwr$(Vwr) + ":Size"
  233.     AddMessage M$ + " W= " + Format$(iHeight) + " H= " + Format$(iHeight)
  234. End Sub
  235.  
  236. Sub MV1_StartConfig (Vwr As Integer, SecondaryWindow As Long)
  237.     M$ = NameFromVwr$(Vwr) + ":StartConfig"
  238.     If SecondaryWindow = 0 Then
  239.     Q1$ = " Main Window from "
  240.     Else
  241.     Q1$ = " Secondary Window from "
  242.     End If
  243.     
  244.     AddMessage M$ + Q1$
  245.  
  246. End Sub
  247.  
  248. Sub MV1_StartJump (Vwr As Integer, TopicAddress As Long, ScrollPosition As Long)
  249.     M$ = NameFromVwr$(Vwr) + ":StartJump"
  250.     AddMessage M$ + "Topic # " + Format$(TopicAddress) + " Scroll " + Format$(ScrollPosition)
  251.  
  252. End Sub
  253.  
  254. Sub MV1_Term (Vwr As Integer, hViewerInst As Long)
  255.     M$ = NameFromVwr$(Vwr) + ":Terminate"
  256.     AddMessage M$
  257.     If Vwr > 0 Then Titles.RemoveItem ItemFromVwr(Vwr)
  258. End Sub
  259.  
  260. Function NameFromVwr$ (ByVal myvwr%)
  261. y = Titles.ListCount - 1
  262. For x = 0 To y
  263.     If Titles.ItemData(x) = myvwr% Then
  264.         NameFromVwr$ = Titles.List(x)
  265.         GoTo alldone1
  266.     End If
  267. Next x
  268. NameFromVwr$ = "Non-Viewer"
  269. alldone1:
  270. End Function
  271.  
  272. Function VwrFromItem (ByVal ItemNum)
  273. VwrFromItem = Titles.ItemData(ItemNum)
  274. End Function
  275.  
  276.